<html>
<head><meta charset="utf-8"><title>Dependencies with multiple features sets · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Dependencies.20with.20multiple.20features.20sets.html">Dependencies with multiple features sets</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="221551699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Dependencies%20with%20multiple%20features%20sets/near/221551699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Dependencies.20with.20multiple.20features.20sets.html#221551699">(Jan 04 2021 at 17:13)</a>:</h4>
<p>How does cargo handle dependencies that have multiple dependents by specify a unique feature?</p>
<div class="codehilite"><pre><span></span><code>lib
├── deb_b
│   └── deb_c_feature_2
├── dep_a
│   └── deb_c_feature_1
└── dep_c_feature_3
</code></pre></div>
<p>Above I have a library with 3 dependencies. <code>dep_a</code> and <code>dep_b</code> depend on <code>dep_c</code> but each require the presence of a specific feature. The library itself might also depend on <code>dep_c</code> and require yet another feature. Does <code>dep_c</code> get built multiple times here? Or do the features all get enabled and <code>dep_c</code> is only built once but with the 3 feature flags set?</p>



<a name="221551928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Dependencies%20with%20multiple%20features%20sets/near/221551928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Dependencies.20with.20multiple.20features.20sets.html#221551928">(Jan 04 2021 at 17:15)</a>:</h4>
<p>this one: "all get enabled and <code>dep_c</code> is only built once but with the 3 feature flags set."</p>



<a name="221552156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Dependencies%20with%20multiple%20features%20sets/near/221552156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> UebelAndre <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Dependencies.20with.20multiple.20features.20sets.html#221552156">(Jan 04 2021 at 17:16)</a>:</h4>
<p>Thanks!</p>



<a name="221552494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Dependencies%20with%20multiple%20features%20sets/near/221552494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Dependencies.20with.20multiple.20features.20sets.html#221552494">(Jan 04 2021 at 17:19)</a>:</h4>
<p><span class="user-mention" data-user-id="343063">@UebelAndre</span> It can to something more complicated if some are build dependencies or for different targets, see <a href="https://doc.rust-lang.org/cargo/reference/unstable.html#features">https://doc.rust-lang.org/cargo/reference/unstable.html#features</a> for more detales.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>